package edu.ccut.saturn.authority.impl.authority;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class AuthorityMapping {
	
	private Map<String,List<String>> authorityMapping = new HashMap<String,List<String>>();
	
	private static AuthorityMapping instance = new AuthorityMapping();
	
	private AuthorityMapping() {
		init();
	}

	private void init(){
		List<String> publicResources = new ArrayList<String>();
		publicResources.add("/login.jsp");
		publicResources.add("/admin/web/*.jsp");
		publicResources.add("/extjs/portal/portal.jsp");
		publicResources.add("/edu.ccut.saturn.authority.impl/loginModule/action/*.action");
		publicResources.add("/edu.ccut.saturn.manager.bundles.impl/bundleModule/releaseAction/ReleaseBundle.action");
		authorityMapping.put("publicResources",publicResources);
		List<String> authority1 = new ArrayList<String>();
		authority1.add("/**/*.action");
		List<String> authority2 = new ArrayList<String>();
		authority2.add("/*");
		List<String> authority3 = new ArrayList<String>();
		authority3.add("/**/*.jsp");
		List<String> authority4 = new ArrayList<String>();
		authority4.add("/edu.ccut.saturn.authority.impl/userModule/*/*");
		List<String> authority5 = new ArrayList<String>();
		authority5.add("/edu.ccut.saturn.authority.impl/roleModule/*/*");
		List<String> authority6 = new ArrayList<String>();
		authority6.add("/edu.ccut.saturn.authority.impl/departmentModule/*/*");
		List<String> authority7 = new ArrayList<String>();
		authority7.add("/edu.ccut.saturn.authority.impl/resourceModule/*/*");
		List<String> authority8 = new ArrayList<String>();
		authority8.add("/edu.ccut.saturn.authority.impl/userModule/page/modifyPasswd.jsp");
		authority8.add("/edu.ccut.saturn.authority.impl/userModule/page/success.jsp");
		authority8.add("/edu.ccut.saturn.authority.impl/userModule/action/ModifyPasswd.action");
		authorityMapping.put("edu.ccut.saturn.authority.impl::1",authority1);
		authorityMapping.put("edu.ccut.saturn.authority.impl::2",authority2);
		authorityMapping.put("edu.ccut.saturn.authority.impl::3",authority3);
		authorityMapping.put("edu.ccut.saturn.authority.impl::4",authority4);
		authorityMapping.put("edu.ccut.saturn.authority.impl::5",authority5);
		authorityMapping.put("edu.ccut.saturn.authority.impl::6",authority6);
		authorityMapping.put("edu.ccut.saturn.authority.impl::7",authority7);
		authorityMapping.put("edu.ccut.saturn.authority.impl::8",authority8);
		
	}

	public static AuthorityMapping getInstance() {
		return instance;
	}

	public Map<String, List<String>> getAuthorityMapping() {
		return authorityMapping;
	}
	
}
